package com.yb.project.db.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yb.project.db.domain.Column;
import com.yb.project.db.mapper.ColumnMapper;
import com.yb.project.db.service.ColumnService;

@Service
public class ColumnServiceImpl implements ColumnService {
	
	@Autowired
	private ColumnMapper columnMapper;
	
	@Override
	public List<Column> getColumnList(Column column) {
		// TODO Auto-generated method stub
		return columnMapper.getColumnList(column);
	}
	
	@Override
	public Column getColumnDetails(Column column) {
		// TODO Auto-generated method stub
		return columnMapper.getColumnDetails(column);
	}
	
	@Override
	public void addColumn(Column column) {
		columnMapper.addColumn(column);
	}
	
	@Override
	public void updateColumn(Column column) {
		columnMapper.updateColumn(column);
	}
	
	@Override
	public void deleteColumns(String dbName, String tableName, String[] columnNames) {
		for (String columnName : columnNames) {
			columnMapper.deleteColumn(new Column(dbName, tableName, columnName));
		}
	}
}
